/*
 * Copyright (c) 2024. hallele, Inc All rights reserved.
 */

package cn.hallele.infrastructure.metadata.exception;

import lombok.Getter;

/**
 * hallele系统的基类异常
 *
 * @author anle5
 * @since 2024/9/8 21:29
 */
@Getter
public class HalException extends RuntimeException {
    /**
     * 错误码填充参数
     */
    private Object[] args = new Object[]{};

    /**
     * 无参构造函数
     */
    public HalException() {
        super();
    }

    /**
     * 带message的构造函数
     *
     * @param message message
     */
    public HalException(String message) {
        super(message);
    }

    /**
     * 带message和args的构造函数
     *
     * @param message message
     * @param args    args
     */
    public HalException(String message, Object... args) {
        super(message);
        this.args = args;
    }

    /**
     * 带message、cause和args的构造函数
     *
     * @param message message
     * @param cause   cause
     * @param args    args
     */
    public HalException(String message, Throwable cause, Object... args) {
        super(message, cause);
        this.args = args;
    }

    /**
     * 带cause的构造函数
     *
     * @param cause cause
     */
    public HalException(Throwable cause) {
        super(cause);
    }

    /**
     * 全参构造函数
     *
     * @param message            message
     * @param cause              cause
     * @param enableSuppression  enableSuppression
     * @param writableStackTrace writableStackTrace
     * @param args               args
     */
    protected HalException(
            String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Object... args) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.args = args;
    }
}
